#coding=utf-8
#! /bin/env python

from dffpy import *

STRUCT_TYPE_2_OPLS_TYPE = {
    #alkane
    'CH4' : 'opls_138',
    'HC' : 'opls_140'，
    'CCH3' : 'opls_135',
    'CC2H2' : 'opls_136',
    'CC3H' : 'opls_137',
    'CC4' : 'opls_139',

    #alcohol
    'CCH2O' : 'opls_157',
    'OCH' : 'opls_154',
    'HO' : 'opls_155',
    'CC2HO' : 'opls_158',
    'CC3O' : 'opls_159',

    #ether
    'OC2' : 'opls_180',
    'CH3O' : 'opls_181',
    'CH2O' : 'opls_182',
    'HC' : 'opls_185'
}

class TypingOPLS(TypingEngine):
    instance = TypingOPLS()
    def __init__(self):
        TypingEngine.__init__(self)

    def get_types(self, mol):
        stypes = TypingEngine.get_struct_type(mol)
        result = []
        for i in stypes:
            if STRUCT_TYPE_2_OPLS_TYPE.has_key(i):
                result.append(STRUCT_TYPE_2_OPLS_TYPE[i])
            else:
                result.append(i)
        return result
            
